home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! dupldir.bat Batch file to duplicate a folder
- !
- ! dupldir name
- !
- ! where 'name' is the folder to be duplicated. The name can be preceded by
- ! a path and a volume ID.
- !
- ! dupldir.bat calls uniqueName and extractPath
- !
- ! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
- !
-
- ! ensure that the first parameter is there and that the second one is not
- set doserr=13
- if not "%2 " == " " goto ERR_LBL
- if "%1 " == " " goto ERR_LBL
-
- ! ensure that the requested folder is there
- set doserr=27
- if not existdir "%1" goto ERR_LBL
-
- ! make the new name and check that it is valid
- call uniqueName "%1" dupldir_newName
- if not %doserr% == 0 goto ERR_LBL
-
- ! do the actual duplication
- call extractPath "%1" dupldir_path
- if not %doserr% == 0 goto ERR_LBL
- if "%dupldir_path%" == %%DUPLDIR_PATH%% goto WITHOUT_PATH_LBL
- incr dupldir_path by "%dupldir_newName%"
- goto DO_COPY_LBL
- :WITHOUT_PATH_LBL
- set dupldir_path=%dupldir_newName%
- :DO_COPY_LBL
- if existdir "%dupldir_path%" goto DIR_THERE_LBL
- mkdir "%dupldir_path%"
- :DIR_THERE_LBL
-
- ! do the copying
- xcopy/e "%1" "%dupldir_path%"
- set doserr=0
- goto DONE_LBL
-
- :ERR_LBL
- show %doserr%
-
- :DONE_LBL
- ! remove the global variables
- set dupldir_newName=
- set dupldir_path=
-